import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/MainView'  // 添加重定向
  },
  {
    path: '/A',
    redirect: '/AdminLogin'  // 添加重定向
  },
    //游客界面

  {
    path: '/NavHome',
    name: 'NavHome',
    component: ()=>import("@/view/NavHome.vue"),
    children: [
      {
        path: '/MainView',
        name: 'MainView',
        component: ()=>import("@/view/MainView.vue"),
      },
      {
        path: '/search',
        name:'search',
        component: ()=>import("@/view/OrderFlight.vue"),
      },
      {
        path: '/help',
        name: 'help',
        component: ()=>import("@/view/UserHelp.vue"),
      },
      {
        path: '/UserCenter',
        name: 'UserCenter',
        component: ()=>import("@/view/UserMessage.vue"),
      }
    ]
  },
  {
    path: '/Login',
    name: 'Login',
    component: ()=>import("@/view/UserLogin.vue"),
  },
  {
    path: '/UserRegister',
    name: 'UserRegister',
    component: ()=>import("@/view/UserRegister.vue"),
  },
  //管理员界面
    {
    path: '/AdminLogin',
    name: 'AdminLogin',
    component: ()=>import("@/view/admin/AdminLogin.vue"),
  },
  {
    path: '/AdminNav',
    name: 'AdminNav',
    component: ()=>import("@/view/admin/AdminNav"),
    children: [
      {
        path: '/AdminCity',
        name: 'AdminCity',
        component: ()=>import("@/view/admin/AdminCity.vue"),
      },
      {
        path: '/AdminFlight',
        name: 'AdminFlight',
        component: ()=>import("@/view/admin/AdminFlight.vue"),
      },
      {
        path: '/AdminAirline',
        name: 'AdminAirline',
        component: ()=>import("@/view/admin/AdminAirline.vue"),
      },
      {
        path: '/AdminPlane',
        name: 'AdminPlane',
        component: ()=>import("@/view/admin/AdminPlane.vue"),
      },
      {
        path: '/AdminFood',
        name: 'AdminFood',
        component: ()=>import("@/view/admin/AdminFood.vue"),
      },
      {
        path: '/AdminTicket',
        name: 'AdminTicket',
        component: ()=>import("@/view/admin/AdminTicket.vue"),
      },
      {
        path: '/AdminTraveller',
        name: 'AdminTraveller',
        component: ()=>import("@/view/admin/AdminTraveller.vue"),
      },
      {
        path: '/AdminOrder',
        name: 'AdminOrder',
        component: ()=>import("@/view/admin/AdminOrder.vue"),
      },
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
